package lab02.test21;

/**
 * Created by dell on 2017/11/1.
 * 统计一个字符串中给定字符出现的频率
 */
public class Test {
    static String str="qwertyasdfgzxcaq";
    static int amount(String s, char c) {

        int count = 0;

        for (int i = 0; i < s.length(); i++) {

            if (s.charAt(i) == c) {

                count++;
            }
        }
        return count;
    }

    public static void main(String args[]) {

        System.out.println(amount(str, 'a'));
    }
}
